home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_stomper.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  191 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_stomper.cog
  4. #
  5. # Control stomper block puzzle in pyramid 1
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13. message    activated
  14. message    arrived
  15. message    entered
  16. message    pulse
  17.  
  18. thing    stomper
  19. thing    button
  20.  
  21. thing    pushcam          nolink
  22. thing    stompercam    nolink
  23. thing    ghostlook    nolink
  24. thing    deathcam    nolink
  25.  
  26. thing    player        local
  27.  
  28. surface    blockface
  29.  
  30. sound    stomperdown=olv_rockhead_hitearth_c.wav    local
  31. sound    indycrush=fol_in_landhurt.wav            local
  32. sound    indycrush2=fol_in_landpuddle.wav        local
  33.  
  34. int        counter=10    local
  35.  
  36. # subroutines
  37. flex    startscene=0.0        local
  38. flex    endscene=0.0        local
  39. flex    fixcams=0.0            local
  40. flex    blockmove=0.0        local
  41. end
  42.  
  43.  
  44. code
  45. activated:
  46.     if (GetSenderRef() != button) return;
  47.  
  48.     player = GetLocalPlayerThing();
  49.     DeselectWeaponWait(GetLocalPlayerThing());
  50.     
  51.     call startscene;
  52.     
  53.     sleep(.5);
  54.     PlayMode(player, 60, 0);
  55.     Sleep(.25);
  56.     MoveToFrame(button, 1, 2);
  57.     WaitForStop(button);
  58.     
  59.     call blockmove;
  60.     call endscene;
  61.     
  62.     return;
  63.     
  64. arrived:
  65. # ---> stomper
  66.  
  67.     if (GetSenderRef() != stomper) return;
  68.  
  69.     if (GetCurFrame(stomper) == 1)
  70.     {
  71.         PlaySoundThing(stomperdown, stomper, 1, -1, -1, 0);
  72.         SetPulse(.1);
  73.     }
  74.     
  75.     return;
  76.  
  77. entered:
  78. # ---> BlockFace (entered by Indy)
  79.     if (GetSenderRef() != blockface) return;
  80.  
  81.     player = GetLocalPlayerThing();
  82.     
  83.     StartCutscene(1);
  84.     MoveToFrame(stomper, 1, 12);
  85.     SetCameraFocus(2, deathcam);
  86.     SetCameraSecondaryFocus(2, ghostlook);
  87.     SetCurrentCamera(2);    
  88.     Sleep(.35);
  89.     
  90.     #kill indy
  91.     EndCutscene();
  92.     DamageThing(player, 1000, 0x1, player);
  93.     PlaySoundLocal(indycrush, 1, 0, 0x0, 0);
  94.     PlaySoundLocal(indycrush2, 1, 0, 0x0, 0);
  95.     
  96.     sleep(.01);
  97.  
  98.     SetThingFlags(player, 0x80000);
  99.  
  100.     return;
  101.  
  102. blockmove:
  103.     #if block is up, move it down, and vice-versa
  104.     if (GetCurFrame(stomper) == 0)
  105.     {
  106.         #switch cameras
  107.         SetCameraFocus(2, stompercam);
  108.         SetCameraSecondaryFocus(2, ghostlook);
  109.         SetCurrentCamera(2);
  110.         
  111.         MoveToFrame(stomper, 1, 12);
  112.         WaitForStop(stomper);
  113.         counter = 5;
  114.         SetPulse(.1);
  115.         
  116.         MoveToFrame(button, 0, 1);
  117.         MoveToFrame(stompercam, 1, 1);
  118.         WaitForStop(stompercam);
  119.     }
  120.     else
  121.     {
  122.         SetCameraFocus(2, stompercam);
  123.         SetCameraSecondaryFocus(2, ghostlook);
  124.         SetCurrentCamera(2);
  125.         
  126.         MoveToFrame(button, 0, 1);
  127.         MoveToFrame(stomper, 0, 4);
  128.         Sleep(1);
  129.     }
  130.  
  131.     sleep(1);
  132.     
  133.     return;
  134.     
  135. startscene:
  136.     call fixcams;
  137.  
  138.     StartCutscene(1);
  139.     StopThing(player);
  140.     SetActorFlags(player, 0x200000);
  141.     SetExtCamOffsetToThing(pushcam);    
  142.  
  143.     return;
  144.             
  145. endscene:
  146.     call fixcams;
  147.  
  148.     ClearActorFlags(player, 0x200000);
  149.  
  150.     SetCurrentCamera(1);
  151.     if (GetCurFrame(stomper) == 0)
  152.     {
  153.         MoveToFrame(stompercam, 0, 10);
  154.     }
  155.     
  156.     EndCutscene();
  157.     RestoreExtCam();
  158.  
  159.     return;
  160.  
  161. fixcams:
  162.     #reset camera settings
  163.     ResetCameraFOV(0, 0);
  164.     SetCameraPosInterp(2, 0);
  165.     SetCameraLookInterp(2, 0);
  166.     SetCameraPosInterp(1, 0);
  167.     SetCameraLookInterp(1, 0);
  168.     RestoreExtCam();
  169.     return;
  170.  
  171. pulse:
  172.     
  173.     if (counter > 1)
  174.     {
  175.         counter = counter - 1;
  176.         
  177.         SetPOVShake(VectorScale(VectorSet(RandBetween(-2, 2), RandBetween(-2, 2), RandBetween(-2, 2)), .0007 * counter),
  178.                     VectorScale(VectorSet(RandBetween(-4, 4), RandBetween(-4, 4), RandBetween(-4, 4)), .07 * counter),
  179.                     10, 180);
  180.     }
  181.     else
  182.     {
  183.         SetPulse(0);
  184.         counter=10;
  185.     }
  186.  
  187.     return;
  188.  
  189. end
  190.  
  191.